<%@page import="com.baoyanghui.common.Constants"%>
<%@page import="com.baoyanghui.model.CarInfo"%>
<%@page import="com.baoyanghui.model.MerchantType"%>
<%@page import="java.lang.reflect.Field"%>
<%@page import="net.sf.json.JSONArray"%>
<%@page import="com.baoyanghui.model.ResultObject"%>
<%@page import="com.baoyanghui.common.DataChanger"%>
<%@page import="com.baoyanghui.common.InterfaceAccess"%>
<%@page import="java.util.Map"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.util.List"%>
<%@page import="com.baoyanghui.model.MerchantPlace"%>
<%@page import="com.baoyanghui.model.Merchant"%>
<%@page import="net.sf.json.JSONObject"%>
<%@page import="com.baoyanghui.config.Configs"%>
<%@page import="com.baoyanghui.common.Utils"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<script type="text/javascript" src="<%= request.getContextPath() %>/js/my_maintain.js"></script>
<% 
	if (Utils.empty((String)request.getSession().getAttribute(Configs.SESSION_USER_ID))
			|| (Constants.USER_TYPE_MERCHANT == (Integer)request.getSession().getAttribute(Configs.SESSION_USER_TYPE))) {
		response.getWriter().print("<script type='text/javascript'>\n");
		response.getWriter().print("window.location.href='" + request.getContextPath() + "/index.jsp';\n");
		response.getWriter().print("</script>\n");
		response.getWriter().flush();
		return;
	}

	String errorMessage = (String)session.getAttribute("error_message"); 
	session.removeAttribute("error_message");

	JSONObject myCars = null;
	CarInfo car = null;
	List<CarInfo> carList = null;
	Map<String, String> params = new HashMap<String, String>();
	
	try {
		request.setCharacterEncoding("UTF-8");
		
		params.put("customer_id", (String)session.getAttribute(Configs.SESSION_USER_ID));
		params.put("usercode", (String)session.getAttribute(Configs.SESSION_USERCODE));
		
		myCars = InterfaceAccess.callInterface("/customer/get_my_cars", params);
		carList = (List<CarInfo>)JSONArray.toList(myCars.getJSONArray("resultData"), CarInfo.class);
	} catch (Exception e) {
	}
%>
       		<div style="width: 350px; height:850px; float: left; position: relative; top: -5px; background: url('../image/line_vertical_gradient.png') right repeat-y;">
				<div style="padding-top: 20px; padding-right: 10px;" align="right">
					车辆<select id="slt_car" onchange="freshMaintains();">
<%
	for (int i = 0; carList != null && i < carList.size(); i++) {
		car = carList.get(i);
%>
						<option value="<%= car.getCarLicense() %>"><%= car.getCarLicense() %></option>
<%
	}
%>
					</select>
					状态<select id="slt_status" onchange="freshMaintains();">
						<option value="" selected="selected">全部</option>
						<option value="complete">已完成</option>
						<option value="waiting">进行中</option>
					</select>
				</div>
				<div id="div_order_list">
				</div>
			</div>
			<div id="div_maintain_order_detail" style="width: 400px; height:850px; float: left; position: relative; top: -5px; padding-left: 10px;
				background: url('../image/line_vertical_gradient.png') right repeat-y;">
			</div>
			<div style="clear: both;"></div>